//
//  UIButton+M1Handle.m
//  NewMarryU
//
//  Created by apple on 2018/7/23.
//  Copyright © 2018年 Cedar. All rights reserved.
//

#import "UIButton+M1Handle.h"

@implementation UIButton (M1Handle)
-(void)m1_handler:(void(^)(UIButton *sender))action{
    objc_setAssociatedObject(self, @"m1_btn_key", action, OBJC_ASSOCIATION_COPY);
    [self addTarget:self action:@selector(m1_action:) forControlEvents:UIControlEventTouchUpInside];
}
-(void)m1_action:(UIButton *)sender{
    void(^action)(UIButton *sender) = objc_getAssociatedObject(self, @"m1_btn_key");
    if (action) {
        action(sender);
    }
}
@end
